<?php

/*
 * This script belongs to Aspect PHP.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This script is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
 * General Public License for more details.
 */

/**
 * The aspectJoinpoint object contains context information when a pointcut matches
 * and the registered advices are executed
 *
 * @package    aspectPhp
 * @subpackage lib
 * @author     gboisse
 */
interface aspectJoinpoint {

    /**
     * Returns the name of the target class this join point refers to
     *
     * @return string The name of the targeted class
     */
    public function getClassName();

    /**
     * Returns the name of the method this join point refers to
     *
     * @return string The name of the target method
     */
    public function getMethodName();

    /**
     * Returns an array of arguments which have been passed to the target method
     *
     * @return array Array of arguments
     */
    public function getMethodArguments();

    /**
     * Returns the value of the specified method argument
     *
     * @param  string $argumentName Name of the argument
     * @return mixed Value of the argument
     */
    public function getMethodArgument($argumentName);

    /**
     * Returns true if the argument with the specified name exists in the
     * method call this joinpoint refers to
     *
     * @param string $argumentName Name of the argument to check
     * @return boolean Returns true if the argument exists
     */
    public function hasMethodArgument($argumentName);

    /**
     * Returns the result of the method invocation. The result is only
     * available for afterReturning advices
     *
     * @return mixed Result of the method invocation
     */
    public function getResult();

    /**
     * If an exception was thrown by the target method.
     * Only makes sense for afterThrowing advices
     *
     * @return boolean
     */
    public function hasException();

    /**
     * Returns the exception which has been thrown in the target method.
     * If no exception has been thrown, null is returned.
     * Only makes sense for afterThrowing advices
     *
     * @return Exception The exception thrown or null
     */
    public function getException();
}
